package cn.edu.sdjzu;

import org.springframework.boot.ConfigurableBootstrapContext;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
@EnableDiscoveryClient
public class NacosApplication {
    public static void main(String[] args) {
        // 启动应用并获取 ApplicationContext
        ConfigurableApplicationContext bootstrapContext = SpringApplication.run(NacosApplication.class, args);

        // 获取配置属性并打印
        String user1 = bootstrapContext.getEnvironment().getProperty("user");
        String age = bootstrapContext.getEnvironment().getProperty("age");
        System.out.println("username = " + user1 + ", age = " + age);
    }
}